<div class="order-list-page" ng-if="pagedata.op == 'list'">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">我的客户</div>
		<div class="fui-header-right"></div>
	</div>
	<div style="margin-top:58px"></div>
	<div class='fui-content order-list'>
	<div style="padding:0.5rem">
	<div class="fui-list-group order-item" ng-repeat="item in pagedata.list">
                    <div class="fui-list goods-list">
                            <div class="fui-list-media" style="">
                                <img class="" ng-src="{{tomedia(item.member.avatar) || '../core/resource/images/nopic.jpg'}}">
                            </div>
                            <div class="fui-list-inner" style="height:auto">
                               <div class="text goodstitle towline">{{item.member.nickname || '无昵称'}}(<span class="red">ID:{{item.mid}}</span>)</div>
								<div class="text goodstitle">【{{item.merch.merchname || '总部平台'}}】</div>
								<div class="text goodstitle">
								<div class="btn btn-sm btn-success-o order-finish" href="javascript:" ng-click="pagedata.goodslist=item.goodslist;pagedata.showgoods=true">配送商品总览</div>
								</div>
                            </div>
                     </div>
					<div class="fui-list">
                        <div class="fui-list-inner">
							<div style="line-height:1.4;color:#999;font-size:0.65rem"><i class="icon icon-wo1"></i> 联系人： <span class="text-danger">{{item.member.realname}}  </span> 联系电话： <a href="tel:{{item.member.mobile}}" class="text-danger">{{item.member.mobile}}</a></div>
							<div style="line-height:1.4;color:#999;font-size:0.65rem"><i class="icon icon-ditu"></i> 客户地址：{{item.addressinfo}}
								<a href="javascript:" ng-click="pagedata.openLocation(item.address);"  style="color:red;font-size:0.65rem;line-height: 1.5;"><i class="icon icon-lvyoutehui"></i>导航</a>
							</div>
						</div>
					</div>
					<div  class="fui-list-group-title lineblock opblock">
						<span class="status noremark">
							<div class="btn btn-sm btn-red order-finish" style="font-size:0.7rem" href="javascript:" ng-click="access_json('/setpei//buymid='+item.mid);">设置商品配送</div>
							<div class="btn btn-sm btn-success-o order-finish" href="javascript:" ng-click="pagedata.post.id=item.id;pagedata.changeshow=true">转客户</div>
						</span>
					</div>
        </div>
	</div>
	</div>
	<div class="content-empty" ng-show="pagedata.list.length == 0 ">
		  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">您暂时没有绑定任何客户！</p>
	</div>
</div>
<div ng-include="sys_html('_peifooter')"></div>
<div ng-if="pagedata.changeshow" class="popup">
	<div class="popup-body">
		<div class="popup-bottom">
			<i class="closed icon icon-cuowu" ng-click="pagedata.changeshow=false"></i>
			<div class='fui-content' style="padding:0.5rem">
				<div class="tips tips-yellow">
						<i class="fa fa-bullhorn alert-link"></i> 当前正在进行转单操作！
				</div>
				<div ng-if="pagedata.peisetting.is_zhuan==1" class="weui_cell weui_cell_switch">
					<div class="weui_cell_hd">需要指定配送员？</div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_switch" type="checkbox" ng-checked="pagedata.post.need_setpeisong==1" ng-click="toogle(pagedata.post,'need_setpeisong',[1,0])">
					</div>
				</div>
				<div class="weui_cell weui_cell_select ng-scope" ng-if="pagedata.post.need_setpeisong==1 && pagedata.peisetting.is_zhuan==1">
						<div class="weui_cell_hd">
							指定配送员
						</div>
						<div class="weui_cell_bd weui_cell_primary">
							<select class="weui_select ng-pristine ng-valid ng-empty ng-touched" ng-model="pagedata.post.paisong_id">
								<option ng-repeat="op in pagedata.peisongs" ng-selected="pagedata.post.paisong_id==op.mid" value="{{op.mid}}" class="ng-binding ng-scope">{{op.title}}</option>
							</select>
						</div>
				</div>
				<div ng-if="pagedata.peisetting.is_zhuan!=1" class="weui_cell weui_cell_switch">
					<div class="weui_cell_hd">确定要转单？转单后该客户的所有订单将重新进入无人配送模式！</div>
				</div>
				<div class="weui_btn_area">
				 <a class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="post(pagedata.post,'/worker_order/change/');pagedata.changeshow=false">提交</a>
				 </div>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showgoods" class="popup">
	<div class="popup-body">
		<div class="popup-bottom">
		<i class="closed icon icon-cuowu" ng-click="pagedata.showgoods=false"></i>
		<div class="fui-cell-group fui-cell-click mod-group" style="max-height:20rem;overflow-y:scroll;padding-bottom:1rem">
							<a class="fui-cell external">
								<div class="fui-cell-text bold">定期配送商品总览</div>
								<div class="fui-cell-remark noremark" style="font-size: 0.65rem;">
								</div>
							</a>
							<div class="fui-icon-group col-5">
								<div class="fui-icon-col-sm external">
									<div class="text bold">商品图片</div>
								</div>
								<div class="fui-icon-col-sm external">
									<div class="text bold">商品名称</div>
								</div>
								<div class="fui-icon-col-sm external">
									<div class="text bold">商品总数</div>
								</div>
								<div class="fui-icon-col-sm external">
									<div class="text bold">已配送数量</div>
								</div>
								<div class="fui-icon-col-sm external">
									<div class="text bold">剩余数量</div>
								</div>
							</div>
							<div ng-repeat="item in pagedata.goodslist" class="fui-icon-group col-5">
								<div class="fui-icon-col-sm">
									<img style="width:2rem" ng-src="{{tomedia(item.image) ||'../core/resource/images/nopic.jpg'}}"/>
								</div>
								<div class="fui-icon-col-sm">
									<div class="info" style="font-size:0.6rem">{{item.title}}
									<div class="red" ng-if="item.selespename">[{{item.selespename}}]</div>
									</div>
								</div>
								<div class="fui-icon-col-sm">
									<div class="text bold">{{item.allnum}}</div>
								</div>
								<div class="fui-icon-col-sm">
									<div class="text bold">{{item.issendnum}}</div>
								</div>
								<div class="fui-icon-col-sm">
									<div class="text bold">{{item.lastnum}}</div>
								</div>
							</div>
							<div class='content-empty' ng-show="!pagedata.goodslist || pagedata.goodslist.length<=0" style="margin:1rem;">
								<i class='fa fa-comment-o'></i><br/>暂时没有商品!
							</div>
			</div>
			</div>
		</div>
</div>
<script>
scope.tool.get_list('jy_peimilk/orderuser/list/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_peimilk/orderuser/list/');
}
scope.pagedata.openLocation=function(item){
	var pcdaddress= item.pcd?item.pcd.province+item.pcd.city+item.pcd.district+item.pcd.street:'';
	var post={
		'address':pcdaddress+item.address,
		'city':item.pcd?item.pcd.city:''
	}
	scope.tool.get_latlng(post,function(res){
		var lat_lng = res.location
		var address_components = res.address_components
		wx.openLocation({
			latitude: lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
			longitude: lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
			name: pcdaddress, // 位置名
			address: item.address, // 地址详情说明
			scale: 20, // 地图缩放级别,整形值,范围从1~28。默认为最大
			infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
			success:function(){
				//alert(1111);
			},
			fail:function(res){
				scope.message('导航异常，可能是权限问题：'+res.errMsg);
			}
		});
	});

}
</script>